/**
*@author: German Barrios @ 01-13-2008
*/
public class DeleteForumController {
	
	/**
	* Construct
	*/
	public DeleteForumController (){}
	
	private String urlId = System.currentPageReference().getParameters().get('id');
	
	String forumId = '';
	/**
	* Get Topic Id
	*@return String
	*/
	public String getForumId() {	
		return forumId;
	}
	
	/**
	* Set Topic Id
	*@param String
	*/
	public void setForumId(String fID) {	
		forumId = fID;
	}
	
	/**
	* Delete Topic by Id
	*/
	public PageReference deleteForum(){

		PageReference pr = new PageReference( '/apex/DiscussionOverview' );
		pr.setRedirect( false );

		List<DiscussionForum__c> forumToDelete = new List<DiscussionForum__c>();		
		if( this.urlId != null )
		{
			forumToDelete = [select Id from DiscussionForum__c where Id =: urlId ];
			pr.setRedirect( true );
		}
		else
			 forumToDelete = [select Id from DiscussionForum__c where Id =: forumId ];
		
		if ( forumToDelete.size() > 0 )
		delete forumToDelete[0];
		
		return pr;
	}
}